<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新品有戏后台管理</title>
    <link href="__CSS__/boot.css" rel="stylesheet">
    <link href="__STATIC__/layui/css/layui.css" rel="stylesheet">
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/layer/layer.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <style>
        th{
            text-align: center;
            vertical-align: middle!important;
        }
    </style>
</head>
<body>
{include file="base/header" /}
<br/>
<button class="layui-btn layui-btn-danger" onclick="excel({$id})">导出EXCEL</button>
<div style="float: right; margin-top: 5px;margin-bottom: 5px" class="box-title ">
    <form class="form-inline" action="{:url('index/shop/inventory')}" method="get">
        <input type="hidden" name="id" value="{$id}">
        <input type="text" name="title" value="<?php if(isset($title)) echo $title ?>" class="form-control" id="exampleInputEmail3" >
        <input type="submit" class="btn btn-default" value="搜索"/>
        <input type="button" onclick="res({$id})" value="全部显示" class="btn btn-default"/>
    </form>
</div>
<table class="table table-bordered" style="width: 1300px;margin: 0 auto">
<tr>
    <th>商品名称</th>
    <th>库存量</th>
</tr>
{foreach $result as $val}
<tr id="del{$val.id}" style="text-align: center">
    <td>{$val.pname}</td>
    <td>{$val.number}</td>
</tr>
{/foreach}
</table>
<div style="margin-left: 30px">{$result->render()}</div>

</body>
<script>
    //显示全部
    function res(id) {
        window.location.href = "{:url('index/shop/inventory')}?id="+id;
    }
    //生成excel
    function excel(sid) {
       window.location.href = "{:url('index/excel/export')}?sid="+sid;
    }
</script>
</html>